#ifndef DBCONNECTIONMANAGER_H
#define DBCONNECTIONMANAGER_H
#include <map>
#include <string>
#include <client/dbclient.h>
#include "dbconnection.h"
using namespace mongo;
using namespace std;

typedef DBConnection<DBClientConnection*,BSONObj> MongoDBConnection;
class DBConnectionManager
{
protected:
    DBConnectionManager();
    ~DBConnectionManager();
    static DBConnectionManager* pInstance;

public:
    static DBConnectionManager* getInstance();
    int addConnection(string connectName,DBClientConnection* connect);
    MongoDBConnection* getConnectByName(string name);
protected:
    int addConnection(MongoDBConnection* connect);
    map<string,MongoDBConnection* > mapName2Connect;
};

#endif // DBCONNECTIONMANAGER_H
